﻿/**************************************************************************
创建时间:	2020/6/24
作	  者:	张存
邮 	  箱:	zhangcunliang@126.com

Copyright (c) zhcun.cn

描	述：
记	录：
***************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;

namespace ZhCun.WebUtils.Configs
{
    public class CommonConfig
    {
        public static readonly CommonConfig THIS = new CommonConfig();

        /// <summary>
        /// http监听端口
        /// </summary>
        public ushort HttpPort { set; get; } = 5001;
        /// <summary>
        /// https监听端口
        /// </summary>
        public ushort HttpsPort { set; get; } = 0;
        /// <summary>
        /// https 密钥文件 .pfx  的名称
        /// </summary>
        public string SSLFileName { set; get; }
        /// <summary>
        /// https 密钥文件 密码
        /// </summary>
        public string SSLFilePassword { set; get; }
        /// <summary>
        /// 应用标题显示
        /// </summary>
        public string AppCaption { set; get; }
        /// <summary>
        /// 开启Swagger
        /// </summary>
        public bool SwaggerEnable { set; get; } = false;
        /// <summary>
        /// Swagger 程序输出XML文件，多个由 , 隔开
        /// </summary>
        public string SwaggerXmlComments { set; get; }
        /// <summary>
        /// swagger 路由模板（进入swagger的基础路径）
        /// </summary>
        public string SwaggerRoutePrefix { get; set; } = "swagger";
        /// <summary>
        /// 登陆超时分钟，默认 30分钟
        /// </summary>
        public int TokenTimeOutPage { set; get; } = 30;
        /// <summary>
        /// webapi登陆超时分钟，默认 30分钟
        /// </summary>
        public int TokenTimeOutApi { set; get; } = 1440;
        /// <summary>
        /// 登录页地址
        /// </summary>
        public string LoginPageUrl { set; get; } = "/User/Login";
        /// <summary>
        /// 用户状态缓存类型
        /// </summary>
        public string LoginStateType { get; set; } = "local";
        /// <summary>
        /// redis 配置文件地址
        /// </summary>
        public string RedisConfig { get; set; }
        /// <summary>
        /// 核心数据库类型
        /// </summary>
        public string CoreDbType { get; set; } = "sqlserver";
        /// <summary>
        /// 核心数据库连接字符串
        /// </summary>
        public string CoreDbConnStr { get; set; }
        /// <summary>
        /// 本地登陆验证的密钥key文件
        /// </summary>
        public string RsaTokenKey { get; set; } = "RsaToken.key";
        /// <summary>
        /// 是否启用body加密，为false 则不下发客户端公钥
        /// </summary>
        public bool RsaBodyEnable { set; get; } = true;
        /// <summary>
        /// body加密的rsa密钥 文件
        /// </summary>
        public string RsaBodyKey { get; set; } = "RsaBody.key";
        /// <summary>
        /// body加密的rsa密钥公钥文件
        /// </summary>
        public string RsaBodyPubKey { get; set; } = "RsaBody.pub.key";
        /// <summary>
        /// 当body加密请求时，是否允许明文请求,默认为true
        /// </summary>
        public bool AllowPlaintext { set; get; } = true;
        /// <summary>
        /// Token header 名
        /// </summary>
        public string TokenName { set; get; } = "TOKEN";
        /// <summary>
        /// body 加密的header名
        /// </summary>
        public string BodyEncryptKeyName { set; get; } = "BodyEncryptKey";
        /// <summary>
        /// 管理员用户Id,默认:00
        /// </summary>
        public string ManageUserId { set; get; } = "00";
        /// <summary>
        /// 管理员角色Id，默认00
        /// </summary>
        public string ManageRoleId { get; set; } = "00";
        /// <summary>
        /// 是否开启监听http（日志输出）
        /// </summary>
        public bool MonitorHttp { get; set; } = true;
    }
}